/*
 * admin  apikey列表搜索
 * @Author: ljb
 * @Date: 2018-03-27 17:51:07
 * @Last Modified by: ljb
 * @Last Modified time: 2019-11-18 17:02:31
 */
<style lang="less" rel="stylesheet/less" type="text/less">
	.user-search-form {
		// padding-left: 40px;
		.ivu-form-item-label {
			font-size: 16px;
		}
	}
</style>

<template>
	<Form
		ref="formInline"
		name="user_query__form"
		class="user-search-form"
		inline
		@keydown.native.enter.prevent="confirmSearch">

		<Form-item
			:label-width="100"

			label="起始日期">
			<DatePicker
				v-model="formValidate.time"
				type="daterange"
				placeholder="请选择开始时间与结束时间"
				style="width: 200px"
                @on-change="changeEDDate"
                />

		</Form-item>


		<Form-item>
			<Button
				type="primary"
				name="user_query__search"
				@click="confirmSearch">
				搜索
			</Button>
		</Form-item>

	</Form>
</template>
<script>

export default {

	data() {
		return {
            realTime:{
            real_started_at: null,
			real_ended_at: null,
            },


			formValidate: {
				time: null,

			}, // 搜索框的对象参数
		};
	},

	methods: {
        changeEDDate(date) {
            if (date[0]==='') {
                this.realTime.real_started_at=null
                this.realTime.real_ended_at=null
            }else{
            this.realTime.real_started_at = this.$moment(date[0]).utc().format();
			this.realTime.real_ended_at = this.$moment(date[1]).utc().format();
            }


		},

		/**
         * 确认搜索
         * @return {undefined}
         */
		confirmSearch() {

			this.$emit('search', this.realTime);
		},

	},

};

</script>
